You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I don't maintain any guarantees with grep specifically, it was my intent to match its behavior here. Moreover, ripgrep's behavior is internally inconsistent:
$ echo wat | rg -f /dev/null
$ echo wat | rg -v -f /dev/null
$ echo wat | grep -f /dev/null
$ echo wat | grep -v -f /dev/null
wat
$ echo wat | rg -f <(echo)
wat
$ echo wat | rg -v -f <(echo)
$ echo wat | grep -f <(echo)
wat
$ echo wat | grep -v -f <(echo)
$
Specifically, the fact that the first two commands above both report no results is wrong.
Originally posted by datatraveller1 February 26, 2025
I want to list all found values from a search and all not found values from a search.
The following is a simplified example. The values searched for are listed in the file search_for.txt.
search_for.txt:
1
2
3
The file in which these values are searched is named searched_in.txt.
searched_in.txt:
item 1
item 2
I use the following commands (note that I'm on MS Windows):
Great so far.
However, if I change the content of file search_for.txt so nothing is found... search_for.txt:
4
5
6
... with the two above commands, the file found.txt gets created as a 0 bytes file (which is correct, because nothing is found) but the file not_found.txt gets also created as a 0 bytes file which doesn't match my expectations.
I have wished to see all values of file search_for.txt as result for the command rg --invert-match --file=found.txt search_for.txt > not_found.txt not_found.txt, wished result:
4
5
6
Isn't the inversion of nothing everything?
If this is the expected behaviour, is there a special flag to achieve what I want for --file and 0 bytes content of this file?
The text was updated successfully, but these errors were encountered:
While I don't maintain any guarantees with grep specifically, it was my intent to match its behavior here. Moreover, ripgrep's behavior is internally inconsistent:
Specifically, the fact that the first two commands above both report no results is wrong.
Discussed in #3000
Originally posted by datatraveller1 February 26, 2025
I want to list all found values from a search and all not found values from a search.
The following is a simplified example. The values searched for are listed in the file search_for.txt.
search_for.txt:
The file in which these values are searched is named searched_in.txt.
searched_in.txt:
I use the following commands (note that I'm on MS Windows):
find entries of file search_for.txt:
not found entries of file search_for.txt:
The result is correct:
found.txt:
not_found.txt:
Great so far.
However, if I change the content of file search_for.txt so nothing is found...
search_for.txt:
... with the two above commands, the file found.txt gets created as a 0 bytes file (which is correct, because nothing is found) but the file not_found.txt gets also created as a 0 bytes file which doesn't match my expectations.
I have wished to see all values of file search_for.txt as result for the command
rg --invert-match --file=found.txt search_for.txt > not_found.txt
not_found.txt, wished result:
Isn't the inversion of nothing everything?
If this is the expected behaviour, is there a special flag to achieve what I want for --file and 0 bytes content of this file?
The text was updated successfully, but these errors were encountered: